/**
 * com.mbmed.doctor.paa1.service.Paa1Service.java
 */
package com.mbmed.doctor.paa1.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Stack;

import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.mbmed.doctor.commons.mapper.ModelVo;
import com.mbmed.doctor.commons.utils.StaticKeys;
import com.mbmed.doctor.paa1.bo.Paa1Bo;
import com.mbmed.doctor.paa1.mapper.Paa1;
import com.mbmed.doctor.paa1.mapper.Paa1DetailBean;
import com.mbmed.doctor.paa1.mapper.Paa1ImgBean;
import com.mbmed.doctor.paa1.mapper.Paa1ListBean;

/**
 * @file  Paa1Service.java
 * @author jiangcangpeng
 * @version 0.1
 * @todo	Paa1服务操作接口
 * Copyright(C), 2013-2014
 *		 Shenzhen Coordinates Software Development Co., Ltd.
 * History
 *   	1. Date: 2014-11-06 06:15:04
 *      	Author: jiangcangpeng
 *      	Modification: this file was created
 *   	2. ...
 */
@Path("/paa1")
@Component
public class Paa1Service {
	
	private static Logger logger = Logger.getLogger(Paa1.class);
	
	@Autowired
	private Paa1Bo paa1Bo;
	
	@Context
	Request request;

	
	/**
	 * 查找所有数据库记录
     * @return type : List 返回查询操作所有符合条件的记录的VO对象集合，操作失败返回null
     */
	@GET
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
    public List<Paa1> getAll() throws Exception{
        List<Paa1> list = new ArrayList<Paa1>();
        return paa1Bo.getAll();        
    }
	
	
	@GET
	@Path("/paa1ListByvaa01vaa07")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
    public List<Paa1ListBean> paa1ListByvaa01vaa07(@QueryParam("vaa01") java.lang.Integer vaa01,
    		@QueryParam("vaa07") java.lang.Integer vaa07) throws Exception{
        List<Paa1ListBean> list = new ArrayList<Paa1ListBean>();
        Map<String,Object> paramMap = new HashMap<String, Object>();
        paramMap.put("acf01", 2);
        paramMap.put("vaa01", vaa01);
        paramMap.put("vaa07", vaa07);
        list = paa1Bo.paa1ListByvaa01vaa07(paramMap);
        return list;
    }
	

	@GET
	@Path("/paa1ListByVaa01AndVaa07_cqxp")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	// 获取检查信息	pacs供应商-重庆旭鹏
    public List<Paa1ListBean> paa1ListByVaa01AndVaa07_cqxp(@QueryParam("vaa01") java.lang.Integer vaa01,
    		@QueryParam("vaa07") java.lang.Integer vaa07) throws Exception{
        List<Paa1ListBean> list = new ArrayList<Paa1ListBean>();
        Map<String,Object> paramMap = new HashMap<String, Object>();
        paramMap.put("acf01", 3);
        paramMap.put("vaa01", vaa01);
        paramMap.put("vaa07", vaa07);
        list = paa1Bo.getPaa1ListByVaa01AndVaa07_cqxp(paramMap);
        return list;
    }
	
	@GET
	@Path("/paa1DetailBypaa01")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
    public Paa1 paa1DetailBypaa01(@QueryParam("paa01") java.lang.Integer paa01) throws Exception{
		Paa1 paa1 = new Paa1();
        List<Paa1DetailBean> list1 = new ArrayList<Paa1DetailBean>();
        list1 = paa1Bo.paa1DetailBypaa01(paa01);
        List<Paa1ImgBean> list2 = new ArrayList<Paa1ImgBean>();
        list2 = paa1Bo.paa1ImgBypaa01(paa01);
        
        if(list1.size()>0){
        	paa1.setResult(StaticKeys.SUCCESS);
        }else{
        	paa1.setResult(StaticKeys.ERROR);
        }
        paa1.setListPaa1Detail(list1);
    	paa1.setListPaa1Img(list2);
        return paa1;
    }
	
	
	  @GET
	  @Path("/paa1imgbyftp")
	  @Produces({"application/xml", "application/json"})
	  public ModelVo paa1ImgByFtp(@QueryParam("paa01") String paa01, @QueryParam("vaa01") String vaa01, @QueryParam("vae01") String vae01, @QueryParam("acf01") String acf01)
	    throws Exception
	  {
	    ModelVo modelVo = new ModelVo();

	    Map paramap = new HashMap();
	    paramap.put("acf01", Integer.valueOf(Integer.parseInt(acf01)));
	    paramap.put("vaa01", Integer.valueOf(Integer.parseInt(vaa01)));
	    paramap.put("vae01", Integer.valueOf(Integer.parseInt(vae01)));
	    paramap.put("paa01", Integer.valueOf(Integer.parseInt(paa01)));

	    List list = new ArrayList();
	    list = this.paa1Bo.getPaa1ImgFtp(paramap);

	    modelVo.setResult("success");
	    modelVo.setList(list);
	    return modelVo;
	  }


	  @GET
	  @Path("/paj1DCMByFtp")
	  @Produces({"application/xml", "application/json"})
	  public ModelVo paj1DCMByFtp(@QueryParam("paa01") String paa01) throws Exception {
			    ModelVo modelVo = new ModelVo();

			    Map paramap = new HashMap();
			    paramap.put("paa01", paa01);

			    List list = new ArrayList();
			    list = this.paa1Bo.getPaj1DCMByFtp(paramap);

			    modelVo.setResult("success");
			    modelVo.setList(list);
			    return modelVo;
			  }
	  
	@GET
	@Path("/paa1ImgBypaa01")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
    public List<Paa1ImgBean> paa1ImgBypaa01(@QueryParam("paa01") java.lang.Integer paa01) throws Exception{
        List<Paa1ImgBean> list = new ArrayList<Paa1ImgBean>();
        list = paa1Bo.paa1ImgBypaa01(paa01);
        return list;
    }
	
	@GET
	@Path("/paa1PACSip")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
    public List<Map> paa1PACSip() throws Exception{
        List<Map> list = new ArrayList<Map>();
        list = paa1Bo.paa1PACSip();
        return list;
    }
	
    /**
     * 查找符合条件的所有数据库记录
     * @param id 与数据库中主键对应的值
     * @return type :  返回查询操作所有符合条件的记录的VO对象，操作失败返回null
     * @throws Exception
     */
	@GET
	@Path("{id}")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
    public Paa1 getPaa1(@PathParam("id") String id) throws Exception{
    	Paa1 paa1 = null;
    	return paa1Bo.get(id);        
    }
    /**
     * 向数据库中插入一条记录
     * @param vo 与数据库中记录对应的值对象
     * @return type : 返回插入操作是否成功
     * @throws Exception
     */
	@POST
	@Produces(MediaType.APPLICATION_JSON)
	@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
	public Paa1 savePaa1(
			@FormParam("paa01") java.lang.Integer paa01,
			@FormParam("paa02") java.lang.String paa02,
			@FormParam("vaf01") java.lang.Integer vaf01,
			@FormParam("vbi01") java.lang.Integer vbi01,
			@FormParam("bbc01") java.lang.String bbc01,
			@FormParam("paa06") java.lang.String paa06,
			@FormParam("paa07") java.lang.String paa07,
			@FormParam("paa08") java.lang.String paa08,
			@FormParam("abbrp") java.lang.String abbrp,
			@FormParam("abbrw") java.lang.String abbrw,
			@FormParam("paa11") java.lang.String paa11,
			@FormParam("paa12") java.lang.String paa12,
			@FormParam("vaa01") java.lang.Integer vaa01,
			@FormParam("vaa07") java.lang.Integer vaa07,
			@FormParam("paa15") java.lang.Integer paa15,
			@FormParam("acf01") java.lang.Byte acf01,
			@FormParam("abw01") java.lang.String abw01,
			@FormParam("paa18") java.lang.Integer paa18,
			@FormParam("aau01") java.lang.String aau01,
			@FormParam("paa20") java.util.Date paa20,
			@FormParam("paa21") java.lang.String paa21,
			@FormParam("bck01a") java.lang.Integer bck01a,
			@FormParam("bck01b") java.lang.Integer bck01b,
			@FormParam("bck01c") java.lang.Integer bck01c,
			@FormParam("bck01d") java.lang.Integer bck01d,
			@FormParam("bcq04") java.lang.String bcq04,
			@FormParam("bdp02") java.lang.String bdp02,
			@FormParam("paa28") java.math.BigDecimal paa28,
			@FormParam("paa29") java.math.BigDecimal paa29,
			@FormParam("paa30") java.lang.Byte paa30,
			@FormParam("paa31") java.lang.Byte paa31,
			@FormParam("paa32") java.lang.Byte paa32,
			@FormParam("paa33") java.lang.Byte paa33,
			@FormParam("paa34") java.lang.Byte paa34,
			@FormParam("paa35") java.lang.Byte paa35,
			@FormParam("paa01a") java.lang.Integer paa01a,
			@FormParam("prncp") java.lang.Integer prncp,
			@FormParam("bhf01a") java.lang.Integer bhf01a,
			@FormParam("bhf01b") java.lang.Integer bhf01b,
			@FormParam("bhf01c") java.lang.Integer bhf01c,
			@FormParam("paa41") java.lang.String paa41,
			@FormParam("bbx01") java.lang.Integer bbx01,
			@FormParam("paa43") java.lang.String paa43,
			@FormParam("paa44") java.lang.String paa44,
			@FormParam("paa45") java.lang.String paa45,
			@FormParam("paa46") java.lang.String paa46,
			@FormParam("paa47") java.lang.String paa47,
			@FormParam("paa48") java.lang.String paa48,
			@FormParam("paa49") java.math.BigDecimal paa49,
			@FormParam("bce01a") java.lang.Integer bce01a,
			@FormParam("bce03a") java.lang.String bce03a,
			@FormParam("bce01b") java.lang.Integer bce01b,
			@FormParam("bce03b") java.lang.String bce03b,
			@FormParam("paa54") java.util.Date paa54,
			@FormParam("bce03c") java.lang.String bce03c,
			@FormParam("bce03d") java.lang.String bce03d,
			@FormParam("bce03e") java.lang.String bce03e,
			@FormParam("bce03f") java.lang.String bce03f,
			@FormParam("bce03g") java.lang.String bce03g,
			@FormParam("bce03h") java.lang.String bce03h,
			@FormParam("bce03i") java.lang.String bce03i,
			@FormParam("bce01j") java.lang.Integer bce01j,
			@FormParam("bce03j") java.lang.String bce03j,
			@FormParam("bce03k") java.lang.String bce03k,
			@FormParam("bce01l") java.lang.Integer bce01l,
			@FormParam("bce03l") java.lang.String bce03l,
			@FormParam("paa67") java.lang.String paa67,
			@FormParam("bce01m") java.lang.Integer bce01m,
			@FormParam("bce03m") java.lang.String bce03m,
			@FormParam("bce01n") java.lang.Integer bce01n,
			@FormParam("bce03n") java.lang.String bce03n,
			@FormParam("paa72") java.lang.String paa72,
			@FormParam("paa73") java.util.Date paa73,
			@FormParam("paa74") java.util.Date paa74,
			@FormParam("vaj01") java.lang.Integer vaj01,
			@FormParam("bce01") java.lang.Integer bce01,
			@FormParam("bce03") java.lang.String bce03,
			@FormParam("paa78") java.lang.String paa78,
			@FormParam("paa79") java.lang.String paa79,
			@FormParam("paa80") java.lang.Byte paa80,
			@FormParam("paa81") java.lang.String paa81,
			@Context HttpServletResponse servletResponse
	) throws Exception {
		Paa1 paa1 = new Paa1();
		paa1.setPaa01(paa01);
		paa1.setPaa02(paa02);
		paa1.setVaf01(vaf01);
		paa1.setVbi01(vbi01);
		paa1.setBbc01(bbc01);
		paa1.setPaa06(paa06);
		paa1.setPaa07(paa07);
		paa1.setPaa08(paa08);
		paa1.setAbbrp(abbrp);
		paa1.setAbbrw(abbrw);
		paa1.setPaa11(paa11);
		paa1.setPaa12(paa12);
		paa1.setVaa01(vaa01);
		paa1.setVaa07(vaa07);
		paa1.setPaa15(paa15);
		paa1.setAcf01(acf01);
		paa1.setAbw01(abw01);
		paa1.setPaa18(paa18);
		paa1.setAau01(aau01);
		paa1.setPaa20(paa20);
		paa1.setPaa21(paa21);
		paa1.setBck01a(bck01a);
		paa1.setBck01b(bck01b);
		paa1.setBck01c(bck01c);
		paa1.setBck01d(bck01d);
		paa1.setBcq04(bcq04);
		paa1.setBdp02(bdp02);
		paa1.setPaa28(paa28);
		paa1.setPaa29(paa29);
		paa1.setPaa30(paa30);
		paa1.setPaa31(paa31);
		paa1.setPaa32(paa32);
		paa1.setPaa33(paa33);
		paa1.setPaa34(paa34);
		paa1.setPaa35(paa35);
		paa1.setPaa01a(paa01a);
		paa1.setPrncp(prncp);
		paa1.setBhf01a(bhf01a);
		paa1.setBhf01b(bhf01b);
		paa1.setBhf01c(bhf01c);
		paa1.setPaa41(paa41);
		paa1.setBbx01(bbx01);
		paa1.setPaa43(paa43);
		paa1.setPaa44(paa44);
		paa1.setPaa45(paa45);
		paa1.setPaa46(paa46);
		paa1.setPaa47(paa47);
		paa1.setPaa48(paa48);
		paa1.setPaa49(paa49);
		paa1.setBce01a(bce01a);
		paa1.setBce03a(bce03a);
		paa1.setBce01b(bce01b);
		paa1.setBce03b(bce03b);
		paa1.setPaa54(paa54);
		paa1.setBce03c(bce03c);
		paa1.setBce03d(bce03d);
		paa1.setBce03e(bce03e);
		paa1.setBce03f(bce03f);
		paa1.setBce03g(bce03g);
		paa1.setBce03h(bce03h);
		paa1.setBce03i(bce03i);
		paa1.setBce01j(bce01j);
		paa1.setBce03j(bce03j);
		paa1.setBce03k(bce03k);
		paa1.setBce01l(bce01l);
		paa1.setBce03l(bce03l);
		paa1.setPaa67(paa67);
		paa1.setBce01m(bce01m);
		paa1.setBce03m(bce03m);
		paa1.setBce01n(bce01n);
		paa1.setBce03n(bce03n);
		paa1.setPaa72(paa72);
		paa1.setPaa73(paa73);
		paa1.setPaa74(paa74);
		paa1.setVaj01(vaj01);
		paa1.setBce01(bce01);
		paa1.setBce03(bce03);
		paa1.setPaa78(paa78);
		paa1.setPaa79(paa79);
		paa1.setPaa80(paa80);
		paa1.setPaa81(paa81);

		return paa1 = paa1Bo.save(paa1);

	}
	/**
     * 删除数据库中与传入的值对象对应的记录
     * @param vo 与数据库中记录对应的值对象
     * @return type : boolean 返回删除操作是否成功
     * @throws Exception
     */
	@DELETE
	@Path("{id}")
	public boolean removePaa1(@PathParam("id") String id) throws Exception{
		if(id == null) return false;
    	return paa1Bo.remove(id);

	}
	
}
